package fpzhan.plane.program.describe;

import fpzhan.plane.program.compose.CodeBlockCompose;
import fpzhan.plane.program.constant.ComposeType;

import java.util.ArrayList;

public class IfsComment<T extends CodeBlockCompose,E> {

    private T t;

    private E e;

    public IfsComment(T t, E e) {
        this.t = t;
        this.e = e;
    }

    public E comment(String comment){
        if (ComposeType.BRANCH.equals(t.getComposeContext().getComposeType())){
            if(t.getComposeContext().getConditionComment()==null){
                t.getComposeContext().setConditionComment(new ArrayList<>());
            }
        }
        t.getComposeContext().getConditionComment().add(comment);
        return e;
    }
}
